import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MaterialSizeInfoVO, MaterialSizeInfoForm, MaterialSizeInfoQuery } from '@/api/material/materialSizeInfo/types';

/**
 * 查询物料尺码列表
 * @param query
 * @returns {*}
 */

export const listMaterialSizeInfo = (query?: MaterialSizeInfoQuery): AxiosPromise<MaterialSizeInfoVO[]> => {
  return request({
    url: '/material/materialSizeInfo/list',
    method: 'get',
    params: query
  });
};

export const listAllMaterialSizeInfo = (query?: MaterialSizeInfoQuery): AxiosPromise<MaterialSizeInfoVO[]> => {
  return request({
    url: '/material/materialSizeInfo/listAll',
    method: 'get',
    params: query
  });
};

/**
 * 查询物料尺码详细
 * @param id
 */
export const getMaterialSizeInfo = (id: string | number): AxiosPromise<MaterialSizeInfoVO> => {
  return request({
    url: '/material/materialSizeInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增物料尺码
 * @param data
 */
export const addMaterialSizeInfo = (data: MaterialSizeInfoForm) => {
  return request({
    url: '/material/materialSizeInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改物料尺码
 * @param data
 */
export const updateMaterialSizeInfo = (data: MaterialSizeInfoForm) => {
  return request({
    url: '/material/materialSizeInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除物料尺码
 * @param id
 */
export const delMaterialSizeInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/material/materialSizeInfo/' + id,
    method: 'delete'
  });
};
